import { request } from "axios";

// 文件上传接口 - 与前端submitUpload方法对应
export const uploadDocuments = (formData) => {
  // 路径从"/document/upload"改为"/api/submissions"
  return request.post("/api/submissions", formData, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });
};

// 查询待审核列表接口 - 与前端fetchPendingSubmissions方法对应
export const getApprovalList = () => {
  // 路径从"/approval/list"改为"/api/submissions/pending"
  // 移除params参数，改为无参请求（如果需要分页等参数可保留）
  return request.get("/api/submissions/pending");
};

// 新增：审核通过接口
export const approveSubmission = (submissionId) => {
  return request.put(`/api/submissions/${submissionId}/approve`);
};

// 新增：审核拒绝接口
export const rejectSubmission = (submissionId, reason) => {
  return request.put(`/api/submissions/${submissionId}/reject`, {
    remark: reason
  });
};



